import {take,put,call,fork} from 'redux-saga/effects';
import getSwiperData from '../servers/serSwiper';

function *sagWatchSwiper() {
    while(true){
        let action=yield take('SWIPER');
        let payload=yield call(getSwiperData,action.data);
        let data=[];
        if(payload.code===200){
            data=payload.data
        }
        yield put({type:'swiper',data:{aSwiper:data}});
        if (action.data.success){
            action.data.success();
        }
    }
}
export default [
    fork(sagWatchSwiper)
]